package br.pucminas.virtual.validator.example;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import br.pucminas.virtual.validator.view.ValidatorEditText;

public class ValidatorExampleActivity extends Activity {

	private ValidatorEditText emailInput;
	private ValidatorEditText phoneNumberInput;
	private ValidatorEditText cpfInput;
	private ValidatorEditText cnpjInput;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_validator_example);

		emailInput = (ValidatorEditText) findViewById(R.id.email_input);
		phoneNumberInput = (ValidatorEditText) findViewById(R.id.phone_number_input);
		cpfInput = (ValidatorEditText) findViewById(R.id.cpf_input);
		cnpjInput = (ValidatorEditText) findViewById(R.id.cnpj_input);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.validator_example, menu);
		return true;
	}

	
	public void validate(View view) {
		emailInput.validate();
		phoneNumberInput.validate();
		cpfInput.validate();
		cnpjInput.validate();
	}
}
